package system

import (
	"server/global"
)

type SysMenu struct {
	global.GvaModel
	ID                  uint          `gorm:"column:id;primaryKey;autoIncrement;comment:菜单ID" json:"id"`
	ParentId            uint          `gorm:"column:parent_id;comment:父级ID" json:"parent_id"`
	GroupId             uint          `gorm:"column:group_id;comment:分组ID" json:"group_id" binding:"required"`
	MenuKey             string        `gorm:"column:menu_key;comment:菜单KEY" json:"menu_key" binding:"required"`
	MenuName            string        `gorm:"column:menu_name;comment:菜单名称" json:"menu_name" binding:"required"`
	Description         string        `gorm:"column:description;comment:菜单描述" json:"description"`
	PermId              uint          `gorm:"column:perm_id;comment:权限ID" json:"perm_id"`
	Path                string        `gorm:"column:path;comment:访问路径" json:"path"`
	Component           string        `gorm:"column:component;comment:组件名称" json:"component" binding:"required"`
	Icon                string        `gorm:"column:icon;comment:图标样式" json:"icon"`
	Hidden              bool          `gorm:"column:hidden;comment:是否隐藏菜单" json:"hidden"`
	HiddenHeaderContent bool          `gorm:"column:hidden_header_content;comment:特殊 隐藏 PageHeader 组件中的页面带的 面包屑和页面标题栏" json:"hidden_header_content"`
	HideChildren        bool          `gorm:"column:hide_children;comment:是否隐藏子菜单" json:"hide_children"`
	Redirect            string        `gorm:"column:redirect;comment:重定向地址" json:"redirect"`
	Target              string        `gorm:"column:target;comment:菜单设置(header_render:是否展示顶栏,footer_render:展示页脚,menu_render:是否展示菜单,menu_header_render:是否展示菜单顶栏,fixed_header:是否固定顶栏,fix_siderbar:是否固定菜单,nav_theme:导航菜单的主题,layout:导航菜单的位置,header_theme:顶部导航的主题)" json:"target"`
	OrderNum            uint          `gorm:"column:order_num;comment:排序数字，值越小越靠前" json:"order_num" binding:"min=0"`
	Group               SysMenuGroup  `gorm:"foreignKey:ID;references:GroupId" binding:"-"`
	Permission          SysPermission `gorm:"foreignKey:ID;references:PermId" binding:"-"`
	Children            []*SysMenu    `gorm:"-" json:"children"` //子菜单列表
}
